﻿<UserControl x:Class="Microsoft.Research.Provenance.Controls.View.VersionHistoryView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="Auto" Width="Auto" AutomationProperties.Name="AIDVersionHistoryView" >

    <UserControl.Resources>
        <ResourceDictionary Source="../ProvenanceControlResources.xaml" ></ResourceDictionary>
    </UserControl.Resources>

    <Expander Expanded="OnExpanded" Header="Version History" IsExpanded="{Binding Path=IsExpanded}" Style="{DynamicResource ExpanderStyle2}" FontSize="12" Margin="10,10,10,10" AutomationProperties.Name="ANameVersionHistoryExpander">
        <Border BorderBrush="#FFC8C8C8" BorderThickness="1,0,1,1" CornerRadius="0,0,5,5">
            <Grid>
                <ScrollViewer HorizontalAlignment="Stretch" Margin="5,5,5,5" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" >
                    <Grid>
                        <ListView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsSynchronizedWithCurrentItem="True" 
                                  ItemsSource="{Binding Path=VersionModels}" AutomationProperties.Name="ANameVersionsListView">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=DisplayName}">
                                        <GridViewColumnHeader >
                                            <TextBlock Text="Workflow Name" HorizontalAlignment="Left" FontWeight="Bold"/>
                                        </GridViewColumnHeader>
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path=DisplayName}" ToolTip="{Binding Path=DisplayName}" TextTrimming="CharacterEllipsis" AutomationProperties.Name="ANameWFDisplayName" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    
                                    <GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=Version}">
                                        <GridViewColumnHeader >
                                            <TextBlock Text="Version" HorizontalAlignment="Left" FontWeight="Bold"/>
                                        </GridViewColumnHeader>
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path=Version}" ToolTip="{Binding Path=Version}" TextTrimming="CharacterEllipsis" AutomationProperties.Name="ANameWFVersion" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    
                                    <GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=ModifiedBy}">
                                        <GridViewColumnHeader >
                                            <TextBlock Text="Modified By" HorizontalAlignment="Left" FontWeight="Bold"/>
                                        </GridViewColumnHeader>
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path=ModifiedBy}" ToolTip="{Binding Path=ModifiedBy}" TextTrimming="CharacterEllipsis" AutomationProperties.Name="ANameWFModifiedBy" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>

                                    <GridViewColumn Width="Auto" DisplayMemberBinding="{Binding Path=ModifiedDate}">
                                        <GridViewColumnHeader >
                                            <TextBlock Text="Modified Date" HorizontalAlignment="Left" FontWeight="Bold"/>
                                        </GridViewColumnHeader>
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path=ModifiedDate}" ToolTip="{Binding Path=ModifiedDate}" TextTrimming="CharacterEllipsis" AutomationProperties.Name="ANameWFModifiedDate" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </Grid>
                </ScrollViewer>
            </Grid>
        </Border>
    </Expander>
</UserControl>
